<template>
  <view>
    <view class="good-item">
      <!-- 左侧图片区域 -->
      <view class="good-item-left">
        <img :src="item.goods_small_logo|| defaultPic" class="goods.pic">
      </view>
      <!-- 右侧标题区域 -->
      <view class="good-item-right">
        <!-- 商品标题 -->
        <view class="good-name">{{item.goods_name}}</view>
          <view class="good-box">
            <!-- |调动,触发后面函数 管道符 -->
            <view class="good-price">￥{{parseFloat(item.goods_price).toFixed(2)}}</view>             
          </view>         
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    name:"my-goods",
    data() {
      return {
        // 默认的图片地址
        defaultPic:'https://img3.doubanio.com/f/movie/8dd0c794499fe925ae2ae89ee30cd225750457b4/pics/movie/celebrity-default-medium.png',
      };
    },
    // 封装循环属性
    props:{
      item:{
        type:Object,
        default:{}
      }
    },
  }
</script>

<style lang="scss">
.good-item{
  display: flex;
  padding: 10px 5px;
  border-bottom: 1px solid #f0f0f0;
  .good-item-left{
    .goods.pic{
      width: 100px;
      height: 100px;
      display: block;
      margin-right: 5px;
    }
  }
  .good-item-right{
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .good-name{
      font-size: 13px;
      }
    .good-box{
        .good-price{
          color: #C00000;
          font-size: 16px
        }
      }
    
  }
}
</style>